const ALL_DATA = {
  errorCode: 200,
  success: true,
  data: [
    {
      id: 1,
      task: 'Learn Javascript',
      completed: true
    },
    {
      id: 2,
      task: 'Learn React',
      completed: false
    },
    {
      id: 3,
      task: 'Learn Ant-Design',
      completed: false
    }
  ],
  message: null
}

export default {
  'get /todos': ALL_DATA,
  'delete /todos': function(req, res) {
    const { id } = req.query
    ALL_DATA.data = ALL_DATA.data.filter(item => item.id !== id)
    res.json(ALL_DATA)
  }
}
